package com.gong.datacensus.mq;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.gong.datacensus.pojo.bo.DataBo;
import org.apache.commons.lang3.StringEscapeUtils;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import redis.clients.jedis.Jedis;

import java.nio.charset.Charset;

/**
 * @Description
 * @Author gongchang
 * @Date 2021-08-15 19:08
 */
@Component
public class DataSolve {

    @Autowired
    Jedis redisUtil;

    @RabbitListener(queues = "DataDirectQueue")
    @RabbitHandler
    public void handler(String msg){
        msg = msg.substring(1,msg.length()-1);
        System.out.println(msg);
        String[] s = msg.split(" ");
        int g = Integer.valueOf(s[0]);
        int e = Integer.valueOf(s[1]);
        System.out.println(g);
        System.out.println(e);
        redisUtil.setbit("grand_data_day",g,"1");
        redisUtil.setbit("grand_data_week",g,"1");
        redisUtil.setbit("grand_data_month",g,"1");
        redisUtil.setbit("equ_data_day",e,"1");
        redisUtil.setbit("equ_data_week",e,"1");
        redisUtil.setbit("equ_data_month",e,"1");
    }
}
